#include <QMutex>
#include "value-result.h"

ValueResult::ValueResult(QObject *parent) :
    AbstractResult(parent)
{
}

QVariant ValueResult::value() const
{
    QMutexLocker lock(m_mutex);
    return m_value;
}

void ValueResult::setValue (const QVariant &value)
{
    QMutexLocker lock(m_mutex);
    m_value = value;
    emitResultReady();
}

void ValueResult::emitResultReady()
{
    QMutexLocker lock(m_mutex);
    QMetaObject::invokeMethod(this, "resultReady", Qt::QueuedConnection, Q_ARG(ValueResult*, this));
}
